#include "settingdialog.h"
#include "ui_settingdialog.h"
#include "tool.h"

SettingDialog::SettingDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::SettingDialog)
{
    ui->setupUi(this);
}

SettingDialog::~SettingDialog()
{
    delete ui;
}

void SettingDialog::loadConfig()
{
    ui->lineEdit->setText(getSetting("rebootTotalTime").toString());
    ui->lineEdit_2->setText(getSetting("videoTotalTime").toString());
    ui->lineEdit_3->setText(getSetting("cpuTemp").toString());
    ui->lineEdit_4->setText(getSetting("stdRebootTimeCost").toString());

}

void SettingDialog::on_buttonBox_accepted()
{
    commitSetting("rebootTotalTime", ui->lineEdit->text());
    commitSetting("videoTotalTime", ui->lineEdit_2->text());
    commitSetting("cpuTemp", ui->lineEdit_3->text());
    commitSetting("stdRebootTimeCost", ui->lineEdit_4->text());
    emit settingFinished();
}
